import { getCookie, setCookie } from "@utils/StorageUtil";
import { getPreviewUrl } from "@utils/WeStudyUtil";
import { Button, Card } from "antd";
import { FC, useEffect, useRef } from "react";

const TrainProblemExplain: FC<any> = ({ problem, refreshProblem, submitTrain }) => {

  // 3. 提交处理
  const handleSubmit = () => {
    var train = Number.parseInt(getCookie("problemTrain"));
    if(train >= 3){
        
    }else{
        refreshProblem(1);
    }
    
  };

  var explainImg = getPreviewUrl() + problem.explainImg;

  return (
    <>
      <Card
        title="答案"
        hoverable
        cover={
          <img
            height={360}
            style={{ objectFit: "contain" }}
            src={explainImg}
          />
        }
      ></Card>
      <Button
        type="primary"
        onClick={handleSubmit}
        size="large"
        style={{
          marginLeft: "20%",
          width: "60%",
          height: 50,
          background: "#52c41a",
          borderRadius: 8,
          fontSize: 16,
          marginTop: 30,
        }}
      >
        下一题
      </Button>
    </>
  );
};

export default TrainProblemExplain;
